﻿


using System.Collections;
namespace forum.ApplicationCode
{
    public class webInteractiveMessage
    {
        public static ArrayList newPostMesaages = new ArrayList();
        public static ArrayList newThreadMesaages = new ArrayList();
        public static ArrayList newRefreshThreadMessage = new ArrayList();
        public static ArrayList newRefreshPostMessage = new ArrayList();

        public static void addNewPost(string postId)
        {
            newPostMesaages.Add(postId);
        }
        public static void addNewThread(string threadId)
        {
            newThreadMesaages.Add(threadId);
        }
        public static void addRefreshThread(string threadId)
        {
            newRefreshThreadMessage.Add(threadId);
        }

        public static void addRefreshPost(string postId)
        {
            newRefreshPostMessage.Add(postId);
        }

        public static string getNewPostMessage()
        {
            return getFirstElementFromArraylist(newPostMesaages);
        }
        public static string getNewThreadMessage()
        {
            return getFirstElementFromArraylist(newThreadMesaages);
        }
        public static string getNewRefreshThreadMessage()
        {
            return getFirstElementFromArraylist(newRefreshThreadMessage);
        }

        public static string getNewRefreshPostMessage()
        {
            return getFirstElementFromArraylist(newRefreshPostMessage);
        }

        private static string getFirstElementFromArraylist(ArrayList tempList)
        {
            string result = "";
            if (tempList.Count > 0)
            {
                result = tempList[0] as string;
                tempList.RemoveAt(0);
            }
            return result;
        }
    }
}